package com.blast.comicsisland.model.recommend.recommendbody;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.LinkedList;
import java.util.List;

/**
 * Created by dell on 2015/6/24.
 */
public class Info {
    //存储漫画信息的列表
    private List<ComicsList> comicsList;

    public List<ComicsList> getComicsList() {
        return comicsList;
    }

    public void setComicsList(List<ComicsList> comicsList) {
        this.comicsList = comicsList;
    }

    //------------------------------->
    //解析部分
    public void jsonParse(JSONObject jsonObject) {
        if (comicsList == null) {
            comicsList = new LinkedList<>();
        }
        try {
            if (jsonObject != null) {
                JSONArray comicsListArr = jsonObject.getJSONArray("comicsList");
                for (int i = 0; i < comicsListArr.length(); i++) {
                    JSONObject object = comicsListArr.getJSONObject(i);
                    ComicsList comicsList1 = new ComicsList();
                    comicsList1.jsonParse(object);
                    comicsList.add(comicsList1);
                }
            }


        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
}
